<?php
/**
 * Created by PhpStorm.
 * User: Gooraye
 * Date: 2016-08-09
 * Time: 11:33
 */
namespace Admin\Controller;
use Recruit\Api\UcenterMemberApi;
use Recruit\Api\CompanyApplyApi;
use Recruit\Api\CompanyEmployApi;
use Recruit\Api\UserResumeApi;
use Recruit\Api\ProjectApi;

class TogetherController extends AdminController{
    /*
     * 招聘审核
     * */
    public function apply_reviewed(){
        $p = I('p','1');
        $page = array('curpage'=>$p,'size'=>10);

        $info = apiCall(CompanyEmployApi::QUERY,array('',$page,'create_time desc'));
        if($info['status']){
            $this->assign('list',$info['info']['list']);
            $this->assign('show',$info['info']['show']);
        }

        $this->display();
    }
    /*
     * 招聘查看
     * */
    public function view_apply(){
        $map['id'] = I('id');
        $info = apiCall(CompanyEmployApi::GET_INFO,array($map));
        if($info['status']){
            $info['info']['text'] = htmlspecialchars_decode($info['info']['text']);
            $this->assign($info['info']);
        }
        $this->display();
    }
    /*
     * 异步Ajax招聘审核不通过
     * */
    public function ajax_areviewed(){
        //需要传输一个是通过审核还是不通过审核
        $id = I('id');
        $entity['valid_status'] = I('g');
        $info = apiCall(CompanyEmployApi::SAVE_BYID,array($id,$entity));
        if($info['status']){
            $this->success('操作成功',U('Together/apply_reviewed'));
        }else{
            $this->error('操作失败',U('Together/apply_reviewed'));
        }

    }

    /*
     * 项目审核
     * */
    public function project_reviewed(){
        $info = apiCall(ProjectApi::QUERY);
        if($info['status']){
            $this->assign('list',$info['info']['list']);
            $this->assign('show',$info['info']['show']);
        }
        $this->display();
    }
    /*
    * 招聘查看
    * */
    public function view_project(){
        $this->display();
    }
    /*
     * 异步Ajax招聘审核不通过
     * */
    public function ajax_previewed(){
        //需要传输一个是通过审核还是不通过审核
        $id = I('id');
        $entity['is_auth'] = I('g');
        $info = apiCall(ProjectApi::SAVEBYID,array($id,$entity));
        if($info['status']){
            $this->success('操作成功',U('Together/project_reviewed'));
        }else{
            $this->error('操作失败',U('Together/project_reviewed'));
        }
    }
}